package com.yueyang.sojourn.server.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author Andy.yang
 * @version v1
 * @summary
 * @Copyright (c) 2019, YueYang Group All Rights Reserved.
 * @since 2020/3/30
 */
public interface ShareConstans {

    /**
     * 分账单状态
     */
    @AllArgsConstructor
    enum ShareStatusEnum implements IEnum {
        /**
         * 订单状态 枚举
         */
        TO_SHARE(10, "待分账"),
        SHARED(20, "已分账"),
        CLOSED(30, "已关闭")
        ;

        @Getter
        private int code;

        @Getter
        private String desc;

        public static ShareStatusEnum ofCode(Integer code) {
            return Arrays.stream(ShareStatusEnum.values()).filter(operStatusEnum -> operStatusEnum.code == code).findFirst().orElse(null);
        }
    }
}
